package cn.ll.util;

import java.util.ArrayList;
import java.util.List;

import cn.ll.po.Permissions;

public class SystermUtil {
	/**
	 * 根据permission name 和action name,从一个permission List中获取符合条件的permission 列表
	 * @param permission
	 * @param action
	 * @param plist
	 * @return
	 */
	public static List<Permissions> usrPermissionsList(String permission,String action,List<Permissions> plist){
		List<Permissions> usrPerList = new ArrayList<Permissions>();
		int size = plist.size();
		for(int j = 0; j< size; j++){
			Permissions permissions =  plist.get(j);
			if(permissions.getName().equalsIgnoreCase(permission) && permissions.getAction().equalsIgnoreCase(action)){
				usrPerList.add(permissions);
			}
		}
		return usrPerList;
	}
}
